package com.topnav.mc.admin.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.service.IService;
import com.js.lib.result.Result;
import com.topnav.mc.admin.controller.FullScreenMoniter.ChartDataBean;
import com.topnav.mc.admin.entity.Device;
import com.topnav.mc.admin.entity.GbServer;
import com.topnav.mc.admin.entity.bean.DeviceBean;
import com.topnav.mc.admin.entity.param.DeviceParam;
import com.topnav.mc.base.mc.IMcService;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface IDeviceService extends IMcService<Device, DeviceBean, DeviceParam> {
    /**
     * 从缓存取得
     * @param code
     * @return
     */
    Device getDeviceFromCache(String code);
    /**
     * 保存到缓存
     */
    void saveToCache(Device dev);
    void saveAllToCache();
    void removeFromCache(String deviceCode);
    /**
     * 从缓存取设备
     */
    Device getFromCache(String deviceCode);
    List<Device> getAllFromCache();

    /**
     *统计各类型的注册设备数
     */
    List<Map<String,Object>> countDevices();

    void syncDeviceChannel(Device device);

    /**
     * 按类型统计
     * @param queryWrapper
     * @return
     */
    List<ChartDataBean> countByType(Wrapper queryWrapper);

    /**
     * 所有注册的联网执法仪
     * @param queryWrapper
     * @return
     */
    List<ChartDataBean> countAll(Wrapper queryWrapper);

    /**
     * 按部门统计
     * @param queryWrapper
     * @return
     */
    List<ChartDataBean> countByOrg(Wrapper queryWrapper);


    /**
     * 设备固件升级
     * @param device
     * @return
     */
    Result firmwareUpdgrade(Device device);


    void updateDeviceToGbServer(Device device);

}
